cars = ['audi', 'bmw', 'subaru', 'toyota']
for car in cars:
    if car == 'bmw':
          print(car.upper())
    else:
          print(car.title())

age=18
print(age==18)

car = 'Audi'
print( car.lower() == 'audi' )

requested_topping = 'mushrooms'
if requested_topping != 'anchovies':
    print("Hold the anchovies!")

age_0 = 22
age_1 = 18
print(age_0 >= 21 and age_1 >= 21)

age_1 = 22
print(age_0 >= 21 and age_1 >= 21 )


age_0 = 22
age_1 = 18
print(age_0 >= 21 or age_1 >= 21)

age_0 = 18
print(age_0 >= 21 or age_1 >= 21 )

requested_toppings = ['mushrooms', 'onions', 'pineapple']
print( 'mushrooms' in requested_toppings )
print('pepperoni' in requested_toppings)

banned_users = ['andrew', 'carolina', 'david']
user = 'marie'
if user not in banned_users:
    print(f"{user.title()}, you can post a response if you wish.")

food='huoGUO'
print(food.lower()=="huoguo")

food='labaicai'
print(food != "huoguo")

age = 19
if age >= 18:
    print("You are old enough to vote!")

age = 17
if age >= 18:
    print("You are old enough to vote!")
    print("Have you registered to vote yet?")
else:
    print("Sorry, you are too young to vote.")
    print("Please register to vote as soon as you turn 18!")

age = 12
if age < 4:
    price = 0
elif age < 18:
    price = 25
else:
    price = 40
print(f"Your admission cost is ${price}.")

age = 12

if age < 4:
    price = 0
elif age < 18:
    price = 25
elif age < 65:
    price = 40
elif age >= 65:
    price = 20

print(f"Your admission cost is ${price}.")

requested_toppings = ['mushrooms', 'extra cheese']
if 'mushrooms' in requested_toppings:
    print("Adding mushrooms.")
if 'pepperoni' in requested_toppings:
    print("Adding pepperoni.")
if 'extra cheese' in requested_toppings:
    print("Adding extra cheese.")
print("\nFinished making your pizza!")

requested_toppings = ['mushrooms', 'green peppers', 'extra cheese']

for requested_topping in requested_toppings:
    print(f"Adding {requested_topping}.")

print("\nFinished making your pizza!")

##
for requested_topping in requested_toppings:
    if requested_topping == 'green peppers':
        print("Sorry, we are out of green peppers right now.")
    else:
        print(f"Adding {requested_topping}.")

print("\nFinished making your pizza!")

available_toppings = ['mushrooms', 'olives', 'green peppers',
                        'pepperoni', 'pineapple', 'extra cheese']
requested_toppings = ['mushrooms', 'french fries', 'extra cheese']
for requested_topping in requested_toppings:
     if requested_topping in available_toppings:
          print(f"Adding {requested_topping}.")
     else:
          print(f"Sorry, we don't have {requested_topping}.")
print("\nFinished making your pizza!")


members=['lily','tom','admin','david','amy']

#members=[]
if not members:
    print('We need to find some users!')
else:
    for member in members:
        if member == 'admin':
            print('Hello admin, would you like to see a status report?')
        else:
            print("Hello Jaden, thank you for logging in again.")

members=[]
if not members:
    print("hahahahha")

#练习5.10：检查⽤户名
current_users=['Aa','bb','cc','dd','eE']
new_users=['amy','tom','bB','jane','ee']
#current=[]
#for i in current_users:
#    i=i.lower()
#    current.append(i)
#print(current)

current=[i.lower() for i in current_users]
print(current)

for i in new_users:
    i=i.lower()
    if i in current:
        print(f"{i}重复了，换个名字")
    else:
        print(f'{i}可以使用')


#5.11
numbers=list(range(1,10))
print(numbers)
for i in numbers:
    if i == 1:
        print(f'{i}st')
    elif i==2:
        print(f'{i}nd')
    elif i==3:
        print(f'{i}rd')
    else:
        print(f'{i}th')